//package com.cssy.yd.logic.web;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.commons.lang.StringUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.validation.BindingResult;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import com.alibaba.fastjson.JSONArray;
//import com.cssy.authority.service.IScUserRolewhPlaceService;
//import com.cssy.base.web.BaseController;
//import com.cssy.base.web.BodyMsg;
//import com.cssy.yd.dock.service.IXxm2eMaterialIssueService;
//import com.cssy.yd.logic.entity.LogicOtherInwhItemDO;
//import com.cssy.yd.logic.entity.LogicPoDO;
//import com.cssy.yd.logic.entity.LogicProGetApplyDO;
//import com.cssy.yd.logic.entity.LogicProGetApplyItemDO;
//import com.cssy.yd.logic.entity.LogicProGetDO;
//import com.cssy.yd.logic.entity.LogicProGetItemBatchDO;
//import com.cssy.yd.logic.entity.LogicProGetItemDO;
//import com.cssy.yd.logic.entity.LogicSoWarefreezedealItemBatchDO;
//import com.cssy.yd.logic.entity.LogicSoWarefreezedealItemDO;
//import com.cssy.yd.logic.entity.LogicWhAffstockDO;
//import com.cssy.yd.logic.service.ILogicProGetApplyItemService;
//import com.cssy.yd.logic.service.ILogicProGetApplyService;
//import com.cssy.yd.logic.service.ILogicProGetItemService;
//import com.cssy.yd.logic.service.ILogicProGetService;
//import com.cssy.yd.logic.service.ILogicWhAffStockService;
//import com.cssy.yd.logic.util.SqlUtil;
//import com.plat.exception.SyBaseException;
//import com.plat.helper.JqGridHandler;
//import com.plat.helper.SearchCondition;
//import com.plat.helper.SearchConditions;
//import com.plat.helper.SearchResult;
//import com.plat.util.GlobalResLoader;
//import com.plat.util.OperationFlag;
//import com.plat.util.SessionUtil;
//import com.plat.util.json.OutJsonGrid;
//
//@Controller
//@RequestMapping("/yd/logic/proget")
//public class LogicProGetController extends
//		BaseController<LogicProGetDO> {
//
//	private static final String MANAGER = "/yd/logic/proget/Manager";
//	private static final String EIDT = "/yd/logic/proget/Operation";// 添加、修改、显示页面
//	private static final String ITEMMANGER = "/yd/logic/proget/ItemManager";
//	
//	@Resource(name = "logicProGetService")
//	private ILogicProGetService logicProGetService;
//
//	@Resource(name = "logicProGetItemService")
//	private ILogicProGetItemService logicProGetItemService;
//	
//	@Resource(name = "logicWhAffStockService")
//	private ILogicWhAffStockService logicWhAffStockService;
//	
//	@Resource(name="scUserRolePlaceService")
//	private IScUserRolewhPlaceService scUserRolePlaceService;
//	
//	@Resource(name = "logicProGetApplyService")
//	private ILogicProGetApplyService logicProGetApplyService;
//
//	@Resource(name = "logicProGetApplyItemService")
//	private ILogicProGetApplyItemService logicProGetApplyItemService;
//	
//	@Resource(name="xxm2eMaterialIssueService")
//	private IXxm2eMaterialIssueService ixxmater;
//	
//	@Override
//	public String manager(HttpServletRequest request, Model model)
//			throws Exception {
//		ixxmater.sync();
//		model.addAttribute("wh",SqlUtil.sqlUtil.roleWH(request, scUserRolePlaceService));
//		return MANAGER;
//	}
//	@RequestMapping("itemManager")
//	public String itemManager(HttpServletRequest request, Model model)
//			throws Exception {
//		String itemdata =request.getParameter("data");
////		System.out.println("aaaaaaaaaaaaaaaaa:"+itemdata);
//		String billStatus =request.getParameter("billStatus");
//		String whcode =request.getParameter("whcode");
//		LogicProGetItemDO lGetItemDO =JSONArray.parseObject(new String(itemdata.getBytes("ISO-8859-1"),"UTF-8"), LogicProGetItemDO.class);
//		//		LogicProGetItemBatchDO lGetItemBatchDO = new LogicProGetItemBatchDO();
////		if(lGetItemDO != null){
//////			lGetItemBatchDO.setMaterialsid(lGetItemDO.getMaterialsid());
//////			lGetItemBatchDO.setCode(lGetItemDO.getCode());
//////			lGetItemBatchDO.setName(lGetItemDO.getName());
//////			lGetItemBatchDO.setSpec(lGetItemDO.getSpec());
//////			lGetItemBatchDO.setUnit(lGetItemDO.getUnit());
//////			lGetItemBatchDO.setJquantuty(lGetItemDO.getJquantuty());
//////			lGetItemBatchDO.setJunit(lGetItemDO.getJunit());
//////			lGetItemBatchDO.setYcksl(lGetItemDO.getYcksl());
//////			lGetItemBatchDO.setKcsl(lGetItemDO.getKcsl());
//////			lGetItemBatchDO.setUnitconvert(lGetItemDO.getUnitconvert());
//			if(lGetItemDO.getItemBatch()!=null && !"".equals(lGetItemDO.getItemBatch().trim())){
////				List<LogicProGetItemBatchDO> getItemBList =JSONArray.parseArray(JSONArray.toJSONString(lGetItemDO.getItemBatch()), LogicProGetItemBatchDO.class);
//				lGetItemDO.setItemBatch(JSONArray.toJSONString(lGetItemDO.getItemBatch()));
//			}
//			model.addAttribute("itemdo",lGetItemDO);
//			model.addAttribute("lGetItemDO",JSONArray.toJSONString(lGetItemDO));
//////		model.addAttribute("itemBatch",lGetItemDO.getItemBatch());
////		}
////		Map<String, Object> map = new HashMap<String, Object>();
////		map.put("code", "1A01-0001-02");
////		map.put("whcode", "WH-2013-06-09-0007");
////		List<LogicWhAffstockDO> lAffstockDOs = logicWhAffStockService.findMaterialsByBatchAll(map);
////		for (LogicWhAffstockDO logicWhAffstockDO : lAffstockDOs) {
////			System.out.println("编码:"+logicWhAffstockDO.getCode()+"批次:"+logicWhAffstockDO.getBatch()+"状态:"+logicWhAffstockDO.getStatus()+"库存数量:"+logicWhAffstockDO.getQuantity6());
////		}
////		model.addAttribute("lGetItemDO",itemdata);
//		model.addAttribute("billStatus",billStatus);
//		model.addAttribute("whcode",whcode);
//		return ITEMMANGER;
//	}
//
//	@Override
//	public void list(HttpServletRequest request, HttpServletResponse response)
//			throws Exception {
//		JqGridHandler hander = new JqGridHandler(request);
//		SearchConditions scs = new SearchConditions();
//		hander.getWheres(scs);
//		 Map<String,Object> sqlMap = SqlUtil.sqlUtil.roleWhSqlFilter(request, scUserRolePlaceService,"wh_code");
//		 scs.addCondition((String)sqlMap.get("option"), (List)sqlMap.get("roleWhList"));
//		 if(scs.getOrderBy()==null||"".equals(scs.getOrderBy()))
//			 scs.setOrderBy("dctime desc");
//		SearchResult result = logicProGetService.findListByExample(scs);
//		OutJsonGrid out = new OutJsonGrid(result);
//		out.printJSon(response);
//	}
//	@RequestMapping(value = "/itemlist")
//	public void itemlist(HttpServletRequest request, HttpServletResponse response)
//			throws Exception {
////		String itembatch =request.getParameter("itembatch");
////		List<LogicProGetItemBatchDO> itemBatchDOs=null;
////		if(itembatch != null  && !"".equals(itembatch)){
////			itemBatchDOs=JSONArray.parseArray(new String(itembatch.getBytes("ISO-8859-1"),"UTF-8"), LogicProGetItemBatchDO.class);
////		}
////		SearchResult result= new SearchResult();
////		if(itemBatchDOs != null && itemBatchDOs.size() > 0){
////			result.setRecordCount(itemBatchDOs.size());
////			result.setResults(itemBatchDOs);
////		}
////		 OutJsonGrid out=new OutJsonGrid(result);
////		 out.printJSon(response);
//		String itembatch =request.getParameter("itembatch");
////		System.out.println("rrrrrrrr:"+itembatch);
//		if(itembatch!=null&&!"".equals(itembatch.trim())){
//			itembatch = itembatch.replace("itemBatch\":\"\"[", "itemBatch\":\"[");
//			itembatch = itembatch.replace("]\"\"", "]\"");
//		}
////		System.out.println("ssssssssssssssssssssss:"+itembatch);
//		String whCode =request.getParameter("whCode");
//		List<LogicProGetItemBatchDO> lProGetItemBatchDOs = new  ArrayList<LogicProGetItemBatchDO>();
//		LogicProGetItemDO lGetItemDO=null;
//		if(itembatch != null  && !"".equals(itembatch)){
//			 lGetItemDO =JSONArray.parseObject(new String(itembatch.getBytes("ISO-8859-1"),"UTF-8"), LogicProGetItemDO.class);
//		}
//		Map<String, Object> map = new HashMap<String, Object>();
//		map.put("code", lGetItemDO.getCode());
//		map.put("whcode", whCode);
//		List<LogicWhAffstockDO> lAffstockDOs = logicWhAffStockService.findMaterialsByBatchAll(map);
//		for (LogicWhAffstockDO logicWhAffstockDO : lAffstockDOs) {
//			LogicProGetItemBatchDO logicProGetItemBatchDO = new LogicProGetItemBatchDO();
//			logicProGetItemBatchDO.setCode(lGetItemDO.getCode());
//			logicProGetItemBatchDO.setName(lGetItemDO.getName());
//			logicProGetItemBatchDO.setSpec(lGetItemDO.getSpec());
//			logicProGetItemBatchDO.setStatus(logicWhAffstockDO.getStatus());
//			logicProGetItemBatchDO.setBatch(logicWhAffstockDO.getBatch());
//			logicProGetItemBatchDO.setJunit(lGetItemDO.getJunit());
//			logicProGetItemBatchDO.setUnit(lGetItemDO.getUnit());
//			logicProGetItemBatchDO.setUnitconvert(lGetItemDO.getUnitconvert());
//			logicProGetItemBatchDO.setJquantuty(lGetItemDO.getJquantuty());
//			logicProGetItemBatchDO.setYcksl(lGetItemDO.getYcksl());
//			logicProGetItemBatchDO.setKcsl(logicWhAffstockDO.getQuantity6());
//			logicProGetItemBatchDO.setCustomerID(lGetItemDO.getCode()+logicWhAffstockDO.getStatus()+logicWhAffstockDO.getBatch());
//			lProGetItemBatchDOs.add(logicProGetItemBatchDO);
//		}
//		List<LogicProGetItemBatchDO> itemBatchDOs=null;
//		if(lGetItemDO.getItemBatch() != null  && !"".equals(lGetItemDO.getItemBatch())){
//			 itemBatchDOs=JSONArray.parseArray(lGetItemDO.getItemBatch(), LogicProGetItemBatchDO.class);
//		}
//		if(itemBatchDOs!=null){
//			for (LogicProGetItemBatchDO logicProGetItemBatchDO : lProGetItemBatchDOs) {
//				for (LogicProGetItemBatchDO itemBatchDO : itemBatchDOs) {
//					if(logicProGetItemBatchDO.getCode().equals(itemBatchDO.getCode())&&logicProGetItemBatchDO.getBatch().equals(itemBatchDO.getBatch())&&logicProGetItemBatchDO.getStatus().equals(itemBatchDO.getStatus())){
//						logicProGetItemBatchDO.setManipulation("x");
//						logicProGetItemBatchDO.setQuantuty(itemBatchDO.getQuantuty());
//						logicProGetItemBatchDO.setActureQuantity(itemBatchDO.getActureQuantity());
//					}
//				}
//			}
//		}
//		
//		SearchResult result= new SearchResult();
//		if(lProGetItemBatchDOs != null && lProGetItemBatchDOs.size() > 0){
//			result.setRecordCount(lProGetItemBatchDOs.size());
//			result.setResults(lProGetItemBatchDOs);
//		}
//		 OutJsonGrid out=new OutJsonGrid(result);
//		 out.printJSon(response);
//	}
//	@RequestMapping(value = "/batchlist")
//	public void batchlist(HttpServletRequest request, HttpServletResponse response)
//			throws Exception {
//		JqGridHandler hander = new JqGridHandler(request);
//		String batch = hander.getQueryValue("batch");
//		String itembatch =request.getParameter("itembatch");
//		if(itembatch!=null&&!"".equals(itembatch.trim())){
//			itembatch = itembatch.replace("itemBatch\":\"\"[", "itemBatch\":\"[");
//			itembatch = itembatch.replace("]\"\"", "]\"");
//		}
//		String whcode =request.getParameter("whcode");
//		List<LogicProGetItemBatchDO> lProGetItemBatchDOs = new  ArrayList<LogicProGetItemBatchDO>();
//		LogicProGetItemDO lGetItemDO=null;
//		if(itembatch != null  && !"".equals(itembatch)){
//			 lGetItemDO =JSONArray.parseObject(new String(itembatch.getBytes("ISO-8859-1"),"UTF-8"), LogicProGetItemDO.class);
//		}
//		Map<String, Object> map = new HashMap<String, Object>();
//		SearchConditions scs = new SearchConditions();
//		scs.clearCondition();
//		scs.addCondition("whaff.code", lGetItemDO.getCode(), SearchCondition.OP_EQUAL);
//		scs.addCondition("whaff.whcode", whcode, SearchCondition.OP_EQUAL);
//		scs.addCondition("whaff.batch", batch, SearchCondition.OP_LIKE);
//		scs.setOrderBy("whaff.batch");
//		scs.setRemovedProperty(null);
//		List<LogicWhAffstockDO> lAffstockDOs = logicWhAffStockService.findMaterialsBySearchBatch(scs);
//		for (LogicWhAffstockDO logicWhAffstockDO : lAffstockDOs) {
//			LogicProGetItemBatchDO logicProGetItemBatchDO = new LogicProGetItemBatchDO();
//			logicProGetItemBatchDO.setCode(lGetItemDO.getCode());
//			logicProGetItemBatchDO.setName(lGetItemDO.getName());
//			logicProGetItemBatchDO.setSpec(lGetItemDO.getSpec());
//			logicProGetItemBatchDO.setStatus(logicWhAffstockDO.getStatus());
//			logicProGetItemBatchDO.setBatch(logicWhAffstockDO.getBatch());
//			logicProGetItemBatchDO.setJunit(lGetItemDO.getJunit());
//			logicProGetItemBatchDO.setUnit(lGetItemDO.getUnit());
//			logicProGetItemBatchDO.setUnitconvert(lGetItemDO.getUnitconvert());
//			logicProGetItemBatchDO.setJquantuty(lGetItemDO.getJquantuty());
//			logicProGetItemBatchDO.setYcksl(lGetItemDO.getYcksl());
//			logicProGetItemBatchDO.setKcsl(logicWhAffstockDO.getQuantity6());
//			logicProGetItemBatchDO.setCustomerID(lGetItemDO.getCode()+logicWhAffstockDO.getStatus()+logicWhAffstockDO.getBatch());
//			lProGetItemBatchDOs.add(logicProGetItemBatchDO);
//		}
//		List<LogicProGetItemBatchDO> itemBatchDOs=null;
//		if(lGetItemDO.getItemBatch() != null  && !"".equals(lGetItemDO.getItemBatch())){
//			 itemBatchDOs=JSONArray.parseArray(lGetItemDO.getItemBatch(), LogicProGetItemBatchDO.class);
//		}
//		if(itemBatchDOs!=null){
//			for (LogicProGetItemBatchDO logicProGetItemBatchDO : lProGetItemBatchDOs) {
//				for (LogicProGetItemBatchDO itemBatchDO : itemBatchDOs) {
//					if(logicProGetItemBatchDO.getCode().equals(itemBatchDO.getCode())&&logicProGetItemBatchDO.getBatch().equals(itemBatchDO.getBatch())&&logicProGetItemBatchDO.getStatus().equals(itemBatchDO.getStatus())){
//						logicProGetItemBatchDO.setManipulation("x");
//						logicProGetItemBatchDO.setQuantuty(itemBatchDO.getQuantuty());
//						logicProGetItemBatchDO.setActureQuantity(itemBatchDO.getActureQuantity());
//					}
//				}
//			}
//		}
//		
//		SearchResult result= new SearchResult();
//		if(lProGetItemBatchDOs != null && lProGetItemBatchDOs.size() > 0){
//			result.setRecordCount(lProGetItemBatchDOs.size());
//			result.setResults(lProGetItemBatchDOs);
//		}
//		 OutJsonGrid out=new OutJsonGrid(result);
//		 out.printJSon(response);
//	}
//	@Override
//	public String operationForm(HttpServletRequest request,
//			@PathVariable String id, @PathVariable String flag, Model model)
//			throws Exception {
//		model.addAttribute("wh",SqlUtil.sqlUtil.roleWH(request, scUserRolePlaceService));
//		if (OperationFlag.ADD.equals(flag)) {// 我新增加时操作
//			model.addAttribute("viewflag", "add");
//			model.addAttribute("xx", 1);// 标示能不能修改内容\
//			if(id.equals("1")){
//				model.addAttribute("lingliao",1); //工单领料
//			}else{
//				model.addAttribute("lingliao",0); //非工单领料
//			}
//		} else {
//			LogicProGetDO oi = logicProGetService.findListById(id);
//			/*SearchConditions scs = new SearchConditions();
//			scs.addCondition("get_pro_id",oi.getId(),SearchCondition.OP_EQUAL);
//			scs.setRemovedProperty(null);
//			scs.setOrderBy("code");
//			List<LogicProGetItemDO> loiilist = logicProGetItemService.findListByExample(scs).getResults();*/
//			if (oi.getBillStatus() == 0) {
//				model.addAttribute("xx", 1);// 标示能不能修改内容
//				model.addAttribute("viewflag", "tijiao");
//			} 
//			if (oi.getBillStatus() == 1) {
//				model.addAttribute("viewflag", "shenpi");
//			}
//			if (oi.getBillStatus() == 2) {
//				model.addAttribute("viewflag", "tongguo");
//			}
//			if(oi.getBillStatus() == 3){
//				model.addAttribute("xx", 4);// 标示能不能修改内容
//				model.addAttribute("viewflag", "bhtijiao");
//			}
//			model.addAttribute("oi", oi);
//			//model.addAttribute("axxJson", loiilist);
//		}
//		//获取领料申请单
//		List<String> s=new ArrayList<String>();
//		s.add("0");
//		s.add("1");
//		SearchConditions sc = new SearchConditions();
//		sc.setOrderBy("dctime desc");
//		sc.addCondition("bill_status","2",SearchCondition.OP_EQUAL);
//		sc.addCondition("isnotck",s);
//		sc.addCondition("state",id,SearchCondition.OP_EQUAL);
//		List<LogicProGetApplyDO> apply=logicProGetApplyService.findListByExample(sc).getResults();
//		model.addAttribute("apply", apply);
//		return EIDT;
//	}
//	
//	@RequestMapping("/griditems")
//	public void griditems(HttpServletRequest request,HttpServletResponse response) throws Exception{
//		String id = request.getParameter("id");
//		if(StringUtils.isNotBlank(id)){
//			LogicProGetDO oi = logicProGetService.findListById(id);
//			SearchConditions scs = new SearchConditions();
//			scs.addCondition("get_pro_id",oi.getId(),SearchCondition.OP_EQUAL);
//			scs.setRemovedProperty(null);
//			scs.setOrderBy("code");
//			List<LogicProGetItemDO> loiilist = logicProGetItemService.findListByExample(scs).getResults();
//			OutJsonGrid out = new OutJsonGrid(loiilist);
//			out.printJSon(response);
//		}
//	}
//
//	@Override
//	public Map<String, Object> save(HttpServletRequest request,
//			LogicProGetDO curAP, BindingResult result, Model model)
//			throws Exception {
////		curAP.setOriCode(curAP.getOriCode().replaceAll(",", ""));
//		BodyMsg bodyMap = BodyMsg.getInstance();
//		String itemdata = request.getParameter("addressInfos");
//		if(StringUtils.isBlank(itemdata)){
//			bodyMap.isFail();
//			bodyMap.configWebInfor("物料内容不能为空！");
//			return bodyMap.modelMap;
//		}else{
//			List<LogicProGetItemDO> swItemList = JSONArray.parseArray(itemdata,LogicProGetItemDO.class);
//			for (LogicProGetItemDO sItemDO : swItemList) {
//				if("Y".equals(sItemDO.getOpenBatch())){
//					if(sItemDO.getItemBatch() != null && !"".equals(sItemDO.getItemBatch())){
//						List<LogicProGetItemBatchDO> batchDOs  = JSONArray.parseArray(sItemDO.getItemBatch(), LogicProGetItemBatchDO.class);
//						if(batchDOs==null || batchDOs.size() <= 0){
//							bodyMap.isFail();
//							bodyMap.configWebInfor("物料编码为:'"+sItemDO.getCode()+"'没有分批次填写数据！");
//							return bodyMap.modelMap;
//						}
//					}else{
//						bodyMap.isFail();
//						bodyMap.configWebInfor("物料编码为:'"+sItemDO.getCode()+"'没有分批次填写数据！");
//						return bodyMap.modelMap;
//					}
//				}
//				
//			}
//		}
//		if(!"".equals(curAP.getOriCode()) && curAP.getOriCode() != null){
//			SearchConditions sc = new SearchConditions();
//			sc.addCondition("get_pro_code", curAP.getOriCode());
//			List<LogicProGetApplyDO> applylist =  logicProGetApplyService.findListByExample(sc).getResults();
//			if(applylist.get(0).getIsnotck()==2){
//				bodyMap.isFail();
//				bodyMap.configWebInfor("领料申请单已经完结，不能领料!");
//				return bodyMap.modelMap;
//			}
//		}
//		try {
//			logicProGetService.proGetSave(request,curAP);
//			bodyMap.isSuccess();
//			bodyMap.configWebInfor(GlobalResLoader.getOpsuccess());
//		} catch (SyBaseException e) {
//			e.printStackTrace();
//			bodyMap.isFail();
//			bodyMap.configWebInfor(GlobalResLoader.getOpfailed()
//					+ e.getMessage());
//		}
//		return bodyMap.modelMap;
//	}
//
//	@Override
//	public Map<String, Object> delete(HttpServletRequest request,
//			HttpServletResponse response, Model model) throws Exception {
//		BodyMsg bodyMap = BodyMsg.getInstance();
//		try {
//			String ids = request.getParameter("ids");
//			String[] fields = ids.split(",");
//			for (String field : fields) {
//				LogicProGetDO lout=logicProGetService.findListById(field);
//				lout.setRemoved(Short.parseShort("1"));
//				logicProGetService.update(lout, SessionUtil.getUser(request));
//			}
//
//			bodyMap.isSuccess(GlobalResLoader.getOpsuccess());
//		} catch (Exception e) {
//			e.printStackTrace();
//			bodyMap.isFail(GlobalResLoader.getOpfailed() + e.getMessage());
//		}
//		return bodyMap.modelMap;
//	}
//	@RequestMapping(value = "/getStorageQuaitity")
//	@ResponseBody
//	public String getStorageQuaitity(HttpServletRequest request, HttpServletResponse response ,Model model)throws Exception{
//		String maCode = request.getParameter("maCode");
//		String whCode = request.getParameter("whCode");
//		String hubCode = request.getParameter("hubCode");
//		String status = request.getParameter("status");
//		String batch = request.getParameter("batch");
//		return logicWhAffStockService.getStorageQuaitity(maCode, whCode, hubCode, status, batch)+"";
//	}
//	
//	@RequestMapping(value = "/getWhBatch")
//	@ResponseBody
//	public List<String> getWhBatch(HttpServletRequest request, HttpServletResponse response ,Model model)throws Exception{
//		String maCode = request.getParameter("maCode");
//		String whCode = request.getParameter("whCode");
//		String hubCode = request.getParameter("hubCode");
//		Map<String, String> map=new HashMap<String, String>();
//		if(maCode!=null&&!"".equals(maCode)){
//			map.put("code", maCode);
//		}
//		if(whCode!=null&&!"".equals(whCode)){
//			map.put("whcode", whCode);
//		}
//		if(hubCode!=null&&!"".equals(hubCode)){
//			map.put("hubcode", hubCode);
//		}
//		return logicWhAffStockService.findbatch(map);
//	}
//	
//	@RequestMapping(value = "/updateState")
//	@ResponseBody
//	public Map<String,String> updateState(HttpServletRequest request,
//			HttpServletResponse response, Model model) throws Exception {
//		Map<String, String> map=new HashMap<String, String>();
//		try{
//			String ids = request.getParameter("rows");
//			if(ids!=null&&!"".equals(ids)){
//				LogicProGetDO lot=logicProGetService.findListById(ids);
//				if(lot.getId()!=null){
//					lot.setBillStatus(Short.parseShort("3"));
//					logicProGetService.update(lot, SessionUtil.getUser(request));
//					map.put("msg", "SUCCESS");
//				}
//			}
//		}catch(Exception e){
//			e.printStackTrace();
//			map.put("msg", "ERROR");
//		}
//		return map;
//	}
//	
//	@RequestMapping(value="/applyItemList")
//	public void applyItemList(HttpServletRequest request, HttpServletResponse response)
//			throws Exception {
//		String code=request.getParameter("code");
////		String whCode=request.getParameter("whCode");
//		SearchConditions scs = new SearchConditions();
//		scs.addCondition("get_pro_code",code,SearchCondition.OP_EQUAL);
//		SearchResult result = logicProGetApplyService.findListByExample(scs);
//		List<LogicProGetApplyDO> apply=result.getResults();
//		if(apply!=null&&!apply.isEmpty()&&apply.size()>0){
//			List<LogicProGetApplyItemDO> applyitem=new ArrayList<LogicProGetApplyItemDO>();
//			List<LogicProGetItemDO> progetitem=new ArrayList<LogicProGetItemDO>();
//			SearchConditions sc = new SearchConditions();
//			sc.setRemovedProperty(null);
//			sc.setOrderBy("code");
//			sc.addCondition("get_pro_id",apply.get(0).getId(),SearchCondition.OP_EQUAL);
//			SearchResult sr = logicProGetApplyItemService.findListByExample(sc);
//			applyitem=sr.getResults();
//			if(applyitem!=null&&!applyitem.isEmpty()&&applyitem.size()>0){
//				for(LogicProGetApplyItemDO applyitemDO : applyitem){
//					LogicProGetItemDO progetitemDO = new LogicProGetItemDO();
//					progetitemDO.setMaterialsid(applyitemDO.getMaterialsid());
//					progetitemDO.setCode(applyitemDO.getCode());
//					progetitemDO.setName(applyitemDO.getName());
//					progetitemDO.setSpec(applyitemDO.getSpec());
//					progetitemDO.setJunit(applyitemDO.getJunit());
////					progetitemDO.setStatus("1");
//					progetitemDO.setOpenBatch(applyitemDO.getOpenBatch());
//					progetitemDO.setJquantuty(applyitemDO.getJquantuty());
//					progetitemDO.setUnit(applyitemDO.getUnit());
//					if(applyitemDO.getUnitconvert()==null || "".equals(applyitemDO.getUnitconvert())) {
//						progetitemDO.setUnitconvert(Double.parseDouble("1"));
//					} else{
//						progetitemDO.setUnitconvert(applyitemDO.getUnitconvert());
//					}
//					progetitemDO.setYcksl(sumQuantity(code,applyitemDO.getCode())==null?0.0:sumQuantity(code,applyitemDO.getCode()));
//					progetitem.add(progetitemDO);
////					if(!"Y".equals(applyitemDO.getOpenBatch())){
////						progetitemDO.setKcsl(this.getQuaitity(wlCode, whCode));
////					}
//				}
//			}
//			SearchResult sr1 = new SearchResult();
//			sr1.setResults(progetitem);
//			sr1.setRecordCount(progetitem.size());
//			OutJsonGrid out = new OutJsonGrid(sr1);
//			out.printJSon(response);
//		}
//	}
////	public Double getQuaitity(String code,String whCode)throws Exception{
//////		String code = request.getParameter("maCode");
//////		String whCode = request.getParameter("whCode");
////		
////		String status = "1";
////		String batch = "NoBatch";
//////		System.out.println("code:"+code+"whcode:"+whCode+"status:"+status+"batch:"+batch);
////		return logicWhAffStockService.getStorageQuaitity(code, whCode, null, status, batch);
////	}
//	/**
//	 * 查询当前领料申请已出库数量
//	 * @param code 领料申请编码
//	 * @param macode 领料物料编码
//	 * @return
//	 */
//	private Double sumQuantity(String code,String macode){
//		//logicProGetService
//		SearchConditions scs = new SearchConditions();
//		scs.addCondition("ori_code",code,SearchCondition.OP_EQUAL);
//		SearchResult result = logicProGetService.findListByExample(scs);
//		List<LogicProGetDO> apply=result.getResults();
//		List<String> ids = new ArrayList<String>();
//		Double sunquantity=0.0;
//		if(apply!=null&&!apply.isEmpty()&&apply.size()>0){
//			for(int i=0;i<apply.size();i++){
//				ids.add(apply.get(i).getId());
//			}
//			SearchConditions scs1 = new SearchConditions();
//			scs1.clearCondition();
//			scs1.addCondition("proget.bill_status",2,SearchCondition.OP_EQUAL);
//			scs1.addCondition("item.code",macode,SearchCondition.OP_EQUAL);
//			scs1.addCondition("item.get_pro_id", ids);
//			sunquantity=logicProGetItemService.sumQuantity(scs1);
//		}
//		return sunquantity;
//	}
//	public static void main(String[] args) {
//		String s ="\"";
//		System.out.println(s);
//	}
//}
